import Vue from "vue";

import "normalize.css/normalize.css"; // A modern alternative to CSS resets

import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
// import locale from 'element-ui/lib/locale/lang/en' // lang i18n

import "@/styles/index.scss"; // global css

import App from "./App";
import store from "./store";
import router from "./router";
import $ from "jquery";

import "@/icons"; // icon
import "@/permission"; // permission control

import "default-passive-events"; // 消除调试台警告

//导出execel插件
import JsonExcel from "vue-json-excel";

Vue.component("downloadExcel", JsonExcel);

/*
 *效验input输入值
 *数字格式化两位小数
 *字符串加密
 *日期结束范围设置长期
 */
import { verifyVal, toFixedTwo, toEncrypt, setLongTime } from "@/utils/com";
Vue.prototype.verifyVal = verifyVal; // 挂载全局方法
Vue.prototype.toFixedTwo = toFixedTwo; // 挂载全局方法
Vue.prototype.toEncrypt = toEncrypt; // 挂载全局方法
Vue.prototype.setLongTime = setLongTime; // 挂载全局方法

/* 表单校验rules */
import { rules } from "@/utils/rules";
Vue.prototype.rules = rules; // 挂载全局方法

/* selectOptions 公共数组 */
import * as optionsArr from "@/utils/optionsArr";
Vue.prototype.optionsArr = optionsArr; // 挂载全局方法

/* 注册全局过滤器 */
import * as custom from "@/utils/filters";

Object.keys(custom).forEach(key => {
  Vue.filter(key, custom[key]);
});

/* reqiestFuc 公共请求方法 */
import * as requestFuc from "@/utils/requestFuc";
Vue.prototype.requestFuc = requestFuc; // 挂载全局方法
import { download } from "@/utils/request";
Vue.prototype.download = download; // 挂载全局方法

/* 全局公共组建 */
import components from "@/components/index";

/**
 * 如果你不想用 mock-server
 * 您希望使用MockJs作为mock api
 * 你可以执行: mockXHR()
 *
 * 目前MockJs将在生产环境中使用，
 * 请在上线前删除它!!!
 */
// import { mockXHR } from '../mock'
// if (process.env.NODE_ENV === 'production') {
//   mockXHR()
// }

// set ElementUI lang to EN
// Vue.use(ElementUI, { locale })
Vue.use(ElementUI);

import AMap from "vue-amap";
Vue.use(AMap);

import VueViewer from "v-viewer";
import "viewerjs/dist/viewer.css";
Vue.use(VueViewer);

Vue.config.productionTip = false;

new Vue({
  el: "#app",
  router,
  store,
  render: h => h(App)
});
